package com.linlong.linlongchat.config;

import com.linlong.linlongchat.interceptors.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @Description: webMvc配置
 * @Author: Yhj
 * @Date: 2024/9/19 21:39
 */
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
@Autowired
private LoginInterceptor loginInterceptor;
    /**
     * 添加拦截器LoginInterceptor
     * @param registry
     */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //登录接口和注册和忘记密码接口不拦截
        registry.addInterceptor(loginInterceptor).excludePathPatterns("/user/login","/user/wjmm","/user/register");
    }
}
